from d4.d4_models import D4Dic
from d4.d4_serializers import D4DicSerializer
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView


class DicList(ListCreateAPIView):
    '''
    CBV下的系统字典管理API
    '''
    queryset = D4Dic.objects.all()
    serializer_class = D4DicSerializer

    def get(self, request):
        print("查询被触发了！")
        return self.list(request)


class DicDetail(RetrieveUpdateDestroyAPIView):
    '''
    CBV下的系统字典管理API
    '''
    queryset = D4Dic.objects.all()
    serializer_class = D4DicSerializer
